<!--
 * @Author: wjj3
 * @Date: 2022-11-10 14:10:17
 * @Description: 当前部门
-->

<template>
  <div class="list-container">
    <div class="search-container">
      <el-form ref="elForm" v-model="searchParams" label-width="85px" size="medium">
        <el-row>
          <el-col :span="6">
            <el-form-item label="标题：" class="titles">
              <el-input
                v-model="searchParams.title"
                placeholder="请输入标题"
                class="w100"
                clearable
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="文种名称：">
              <el-input
                v-model="searchParams.definitionName"
                placeholder="请输入文种名称"
                class="w100"
                clearable
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="起草部门：">
              <el-input
                v-model="searchParams.orgName"
                placeholder="请输入起草部门"
                class="w100"
                clearable
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6" class="operate-btn">
            <el-button type="primary" size="small" @click="search">查询</el-button>
            <el-button class="cancel" type="primary" size="small" @click="resetFields">取消</el-button>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="起草人：" class="drafter">
              <el-input
                v-model="searchParams.userName"
                placeholder="请输入起草人"
                class="w100"
                clearable
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="table-container">
      <jdf-table
        v-loading="loading"
        :columns="columns"
        :data="tableData"
        :table-attrs="tableAttrs"
        :pagination-attrs="paginationAttrs"
        :pagination-events="paginationEvents"
      ></jdf-table>
    </div>
  </div>
</template>

<script>
import { renderLink, timeConvert } from 'jdf-util';
import BizMaintainService from '@/api/domains/BizMaintainService';
import listTableMixins from '@/mixins/listTableMixins';

export default {
  mixins: [listTableMixins],
  data() {
    return {
      functionName: 'getArts',
      service: BizMaintainService,
      otherParams: {
        userId: sessionStorage.getItem('userId'),
      },
      columns: [
        {
          type: 'index',
          width: 50,
          label: '序号',
          attrs: {
            align: 'center',
            index: this.getTableRowIndexNo
          }
        },
        {
          prop: 'title',
          label: '标题',
          attrs: {
            'show-overflow-tooltip': true
          },
          render: (h, params) => renderLink(h, params.row.title, () => this.openTaskForm(params.row))
        },
        {
          prop: 'definitionName',
          width: 300,
          label: '文种',
          attrs: {
            align: 'center',
            'show-overflow-tooltip': true,
          }
        },
        {
          prop: 'userName',
          width: 150,
          label: '当前环节处理人',
          attrs: {
            align: 'center'
          }
        },
        {
          prop: 'startTime',
          label: '创建时间',
          width: 200,
          attrs: {
            align: 'center',
            formatter: (row) => timeConvert(row.startTime, 'YYYY-MM-DD HH:mm:ss'),
          }
        }
      ]
    };
  },
  mounted() {
    this.getList();
  },
};
</script>
